﻿using System.Text;
using Microsoft.Phone.Info;

namespace Quebec.Phone.Utilities
{
    public class IdentificationHelper
    {
        public static string GetDeviceUniqueId()
        {
            object property;

            if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out property))
            {
                StringBuilder sb = new StringBuilder(20);
                foreach (byte b in (byte[])property)
                {
                    sb.Append((char)(b % 64 + 32));
                }

                return sb.ToString();
            }

            return null;
        }
    }
}
